# -*- coding: utf-8 -*-

#写一个快速排序算法
import numpy as np
import time

def quick_sort(arr):
    if len(arr) <= 1:
        return arr
    pivot = arr[0]
    left = [i for i in arr[1:] if i <= pivot]
    right = [i for i in arr[1:] if i > pivot]
    return quick_sort(left) + [pivot] + quick_sort(right)


##quick_sor(np.array([1, 2, 3, 4, 5, 6, 7, 8, 9)
arr = np.random.randint(0, 1000000, 1000000)

# 记录开始时间
start_time = time.time()

# 调用函数
arr = quick_sort(arr)
#print(arr)
print("\n")

#my_function()
# 记录结束时间
end_time = time.time()

# 计算并打印运行时间
print(f"函数运行时间为：{end_time - start_time} 秒")